//
//  taskListCell.m
//  PCR
//
//  Created by shumei_imac on 2016/7/12.
//  Copyright © 2016年 shumei. All rights reserved.
//

#import "taskListCell.h"
#import "taskListModel.h"
@interface taskListCell()

{
    taskListCellSelectdesBtnBlock _desBlock;
}
@property (weak, nonatomic) IBOutlet UIButton *desCriptionBtn;
- (IBAction)BtnClick:(UIButton *)sender;

@property (weak, nonatomic) IBOutlet UILabel *goodsNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *priceNumLabel;
@property (weak, nonatomic) IBOutlet UILabel *shopNameLabel;
@property (weak, nonatomic) IBOutlet UIView *detailsView;
@end

@implementation taskListCell


-(void)updateBytaskListItem:(taskListModel *)taskItem{
    self.taskListItem = taskItem;
    _desCriptionBtn.selected = taskItem.isOpen;
    if (!_desCriptionBtn.selected) {
        [_detailsView setHidden:YES];
    }else{
        [_detailsView setHidden:NO];
    }
 
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (IBAction)BtnClick:(UIButton *)sender{
    sender.selected = !sender.selected;
    self.taskListItem.isOpen = sender.selected;
    _desBlock(YES);
    [UIView animateWithDuration:0.2 animations:^{
        _desCriptionBtn.imageView.transform =CGAffineTransformRotate(_desCriptionBtn.imageView.transform, M_PI);
    }];
}

-(void)taskListSelectDesBtnBlock:(taskListCellSelectdesBtnBlock)block{
    block ? _desBlock = [block copy] : nil;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state


}
@end
